/***********************************************************************
 * Module:  CheckDetail.java
 * Author:  eric
 * Purpose: Defines the Class CheckDetail
 ***********************************************************************/
package com.mes.check.domain;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.annotations.BatchSize;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.ForeignKey;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.context.annotation.Lazy;

import com.mes.basicdata.domain.Employee;
import com.mes.common.domain.BasicModel;
import com.mes.inventory.domain.Material;

@Entity()
@Table(name = "M_CHECKDETAIL")
@BatchSize(size = 20)
@Lazy(value = true)
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class CheckBillDetail extends BasicModel implements java.io.Serializable {

	@Id
	@GenericGenerator(name = "uniqueId", strategy = "assigned")
	@Column(name = "UNIQUEID")
	private String uniqueId;

	// 检验单唯一号
	@Column(name = "CHECKUID")
	private String checkBillUid;

	@ForeignKey(name = "null")
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "CHECKUID", insertable = false, updatable = false)
	protected CheckBill checkBill;

	@Column(name = "SEQ")
	public Integer seq;

	@Column(name = "ACTUALSIZE")
	public String actualSize;

	// 尺寸类型
	@Column(name = "FIELDTYPE")
	public String measurementType;

	@Column(name = "CHECKER")
	public String checkerUid;
	//many-to-one
	@ForeignKey(name="null")
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="CHECKER",insertable=false,updatable=false)
	private Employee checker;

	@Column(name = "CHECKTIME")
	public Date checkTime;

	// 尺寸编号
	@Column(name = "FIELDID")
	public String measurementNumber;

	@Column(name = "TOOLUID")
	public String toolUid;

	@Column(name = "CHECKERPRINT")
	public String checkerPrint;

	@Column(name = "REFCHECKSEQ")
	public Integer refCheckSeq;

	@Column(name = "DEFECTQTY")
	public Float defectQty;

	@Column(name = "QUALITYSTATE")
	public Integer qualityState;

	@Column(name = "CHECKPOSITION")
	public String checkPosition;

	@Column(name = "MEASUREBASE")
	public String measureBase;

	@Column(name = "LBOUND")
	public Float lbound;

	@Column(name = "UBOUND")
	public Float ubound;

	@Column(name = "STANDARDVALUE")
	public String standardValue;

	@Column(name = "SUBMITCHECKUID")
	public String submitCheckUid;

	@Column(name = "SPCSTANDARDVALUE")
	public Float spcStandardValue;

	@Column(name = "FIELDORDER")
	public String measurementSeq;

	@Column(name = "MATERIALUSN")
	public String materialUid;
	//many-to-one
	@ForeignKey(name="null")
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="MATERIALUSN",insertable=false,updatable=false)
	private Material material;

	@Column(name = "CHECK_PIC")
	public String checkPic;

	@Column(name = "CHECK_CONTENT")
	public String checkContent;
	
	// 横轴
	@Column(name="X_AXIS",length=100)
	private String xAxis;
	
	// 横轴
	@Column(name="Y_AXIS",length=100)
	private String yAxis;
	
	// 上偏差极限百分比
	@Column(name="UP_LIMIT_PERCENT")
	private Float upperLimitPercent;
		
	// 下偏差极限百分比
	@Column(name="LOW_LIMIT_PERCENT")
	private Float lowerLimitPercent;

	// 是否关键尺寸
	@Column(name="ISKEYFIELD",precision=2,scale=0)
	private Boolean isKeyMeasurement;
	
	// 是否需要采集
	@Column(name = "ISNEEDCOLLECT")
	public Boolean isNeedCollect;

	// 是否需要统计
	@Column(name = "IS_NEED_STATISTIC")
	public Boolean isNeedStatistic;
	
	@Column(name = "ISSUBMITCHECK")
	public Boolean isSubmitCheck;

	@Column(name = "UOM")
	public String uom;

	@Column(name = "OPUID")
	public String operationUid;

	@Column(name = "MANUFACTUREOPUID")
	public String manufactureOperationUid;

	@Column(name = "OPERATIONCHECKORDER")
	public Integer operationCheckOrder;

	@Column(name = "BARCODE")
	public String barCode;

	@Column(name = "DEVIATION")
	public String deviation;

	@Column(name = "CHECKRESULT")
	public String checkResult;

	/** 不合格描述 */
	@Column(name = "DEFECTDESC")
	public String defectDesc;

	/** 自检者 */
	@Column(name = "CHECKER1")
	public String checker1;
	//many-to-one
	@ForeignKey(name="null")
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="CHECKER1",insertable=false,updatable=false)
	private Employee worker;
	
	/** 互检者 */
	@Column(name = "CHECKER2")
	public String checker2;

	/** 自检时间 */
	@Column(name = "CHECKTIME1")
	public Date checkTime1;

	/** 互检时间 */
	@Column(name = "CHECKTIME2")
	public Date checkTime2;

	/** 自检实测值ֵ */
	@Column(name = "ACTUALSIZE1")
	public String actualSize1;

	/** 互检实测值ֵ */
	@Column(name = "ACTUALSIZE2")
	public String actualSize2;

	/** 自检量具 */
	@Column(name = "TOOLUID1")
	public String toolUid1;

	/** 互检量具 */
	@Column(name = "TOOLUID2")
	public String toolUid2;

	public CheckBillDetail() {
		// TODO Auto-generated constructor stub
	}

	@Override
	public String getUuid() {
		// TODO Auto-generated method stub
		return this.uniqueId;
	}

	@Override
	public void setUuid(String uuid) {
		// TODO Auto-generated method stub
		this.uniqueId = uuid;
	}

	/**
	 * Get value of uniqueId
	 *
	 * @return uniqueId
	 */
	public String getUniqueId() {
		return uniqueId;
	}

	/**
	 * Set value of uniqueId
	 *
	 * @param newUniqueId
	 */
	public void setUniqueId(String newUniqueId) {
		this.uniqueId = newUniqueId;
	}

	public String getCheckBillUid() {
		return checkBillUid;
	}

	public void setCheckBillUid(String checkBillUid) {
		this.checkBillUid = checkBillUid;
	}

	/**
	 * @pdGenerated default parent getter
	 */
	public CheckBill getCheckBill() {
		return checkBill;
	}

	/**
	 * @pdGenerated default parent setter
	 * @param checkBill
	 */
	public void setCheckBill(CheckBill checkBill) {
		this.checkBill = checkBill;
	}

	/**
	 * Get value of seq
	 *
	 * @return seq
	 */
	public Integer getSeq() {
		return seq;
	}

	/**
	 * Set value of seq
	 *
	 * @param newSeq
	 */
	public void setSeq(Integer newSeq) {
		this.seq = newSeq;
	}

	/**
	 * Get value of actualSize
	 *
	 * @return actualSize
	 */
	public String getActualSize() {
		return actualSize;
	}

	/**
	 * Set value of actualSize
	 *
	 * @param newActualSize
	 */
	public void setActualSize(String newActualSize) {
		this.actualSize = newActualSize;
	}

	/**
	 * Get value of measurementType
	 *
	 * @return measurementType
	 */
	public String getMeasurementType() {
		return measurementType;
	}

	/**
	 * Set value of measurementType
	 *
	 * @param measurementType
	 */
	public void setMeasurementType(String measurementType) {
		this.measurementType = measurementType;
	}

	/**
	 * Get value of checkerUid
	 *
	 * @return checkerUid
	 */
	public String getCheckerUid() {
		return checkerUid;
	}

	/**
	 * Set value of checkerUid
	 *
	 * @param checkerUid
	 */
	public void setCheckerUid(String checkerUid) {
		this.checkerUid = checkerUid;
	}

	/**
	 * Get value of checkTime
	 *
	 * @return checkTime
	 */
	public java.util.Date getCheckTime() {
		return checkTime;
	}

	/**
	 * Set value of checkTime
	 *
	 * @param newCheckTime
	 */
	public void setCheckTime(java.util.Date newCheckTime) {
		this.checkTime = newCheckTime;
	}

	// /**
	// * Get value of creator
	// *
	// * @return creator
	// */
	// public String getCreator() {
	// return creator;
	// }
	//
	// /**
	// * Set value of creator
	// *
	// * @param newCreator
	// */
	// public void setCreator(String newCreator) {
	// this.creator = newCreator;
	// }
	//
	// /**
	// * Get value of createTime
	// *
	// * @return createTime
	// */
	// public java.util.Date getCreateTime() {
	// return createTime;
	// }
	//
	// /**
	// * Set value of createTime
	// *
	// * @param newCreateTime
	// */
	// public void setCreateTime(java.util.Date newCreateTime) {
	// this.createTime = newCreateTime;
	// }

	/**
	 * Get value of notes
	 *
	 * @return notes
	 */
	// public String getNotes() {
	// return notes;
	// }

	/**
	 * Set value of notes
	 *
	 * @param newNotes
	 */
	// public void setNotes(String newNotes) {
	// this.notes = newNotes;
	// }

	/**
	 * Get value of measurementNumber
	 *
	 * @return measurementNumber
	 */
	public String getMeasurementNumber() {
		return measurementNumber;
	}

	/**
	 * Set value of measurementNumber
	 *
	 * @param measurementNumber
	 */
	public void setMeasurementNumber(String measurementNumber) {
		this.measurementNumber = measurementNumber;
	}

	/**
	 * Get value of toolUid
	 *
	 * @return toolUid
	 */
	public String getToolUid() {
		return toolUid;
	}

	/**
	 * Set value of toolUid
	 *
	 * @param newToolUid
	 */
	public void setToolUid(String newToolUid) {
		this.toolUid = newToolUid;
	}

	/**
	 * Get value of checkerPrint
	 *
	 * @return checkerPrint
	 */
	public String getCheckerPrint() {
		return checkerPrint;
	}

	/**
	 * Set value of checkerPrint
	 *
	 * @param checkerPrint
	 */
	public void setCheckerPrint(String checkerPrint) {
		this.checkerPrint = checkerPrint;
	}

	/**
	 * Get value of refCheckSeq
	 *
	 * @return refCheckSeq
	 */
	public Integer getRefCheckSeq() {
		return refCheckSeq;
	}

	/**
	 * Set value of refCheckSeq
	 *
	 * @param newRefCheckSeq
	 */
	public void setRefCheckSeq(Integer newRefCheckSeq) {
		this.refCheckSeq = newRefCheckSeq;
	}

	/**
	 * Get value of defectQty
	 *
	 * @return defectQty
	 */
	public Float getDefectQty() {
		return defectQty;
	}

	/**
	 * Set value of defectQty
	 *
	 * @param newDefectQty
	 */
	public void setDefectQty(Float newDefectQty) {
		this.defectQty = newDefectQty;
	}

	/**
	 * Get value of qualityState
	 *
	 * @return qualityState
	 */
	public Integer getQualityState() {
		return qualityState;
	}

	/**
	 * Set value of qualityState
	 *
	 * @param newQualityState
	 */
	public void setQualityState(Integer newQualityState) {
		this.qualityState = newQualityState;
	}

	/**
	 * Get value of checkPosition
	 *
	 * @return checkPosition
	 */
	public String getCheckPosition() {
		return checkPosition;
	}

	/**
	 * Set value of checkPosition
	 *
	 * @param newCheckPosition
	 */
	public void setCheckPosition(String newCheckPosition) {
		this.checkPosition = newCheckPosition;
	}

	/**
	 * Get value of measureBase
	 *
	 * @return measureBase
	 */
	public String getMeasureBase() {
		return measureBase;
	}

	/**
	 * Set value of measureBase
	 *
	 * @param newMeasureBase
	 */
	public void setMeasureBase(String newMeasureBase) {
		this.measureBase = newMeasureBase;
	}

	/**
	 * Get value of lBound
	 *
	 * @return lBound
	 */
	public Float getLbound() {
		return lbound;
	}

	/**
	 * Set value of lBound
	 *
	 * @param newLBound
	 */
	public void setLbound(Float lbound) {
		this.lbound = lbound;
	}

	/**
	 * Get value of uBound
	 *
	 * @return uBound
	 */
	public Float getUbound() {
		return ubound;
	}

	/**
	 * Set value of uBound
	 *
	 * @param newUBound
	 */
	public void setUbound(Float ubound) {
		this.ubound = ubound;
	}

	/**
	 * Get value of standardValue
	 *
	 * @return standardValue
	 */
	public String getStandardValue() {
		return standardValue;
	}

	/**
	 * Set value of standardValue
	 *
	 * @param newStandardValue
	 */
	public void setStandardValue(String newStandardValue) {
		this.standardValue = newStandardValue;
	}

	/**
	 * Get value of submitCheckUid
	 *
	 * @return submitCheckUid
	 */
	public String getSubmitCheckUid() {
		return submitCheckUid;
	}

	/**
	 * Set value of submitCheckUid
	 *
	 * @param submitCheckUid
	 */
	public void setSubmitCheckUid(String submitCheckUid) {
		this.submitCheckUid = submitCheckUid;
	}

	/**
	 * Get value of spcStandardValue
	 *
	 * @return spcStandardValue
	 */
	public Float getSpcStandardValue() {
		return spcStandardValue;
	}

	/**
	 * Set value of spcStandardValue
	 *
	 * @param newSpcStandardValue
	 */
	public void setSpcStandardValue(Float newSpcStandardValue) {
		this.spcStandardValue = newSpcStandardValue;
	}

	/**
	 * Get value of measurementSeq
	 *
	 * @return measurementSeq
	 */
	public String getMeasurementSeq() {
		return measurementSeq;
	}

	/**
	 * Set value of measurementSeq
	 *
	 * @param measurementSeq
	 */
	public void setMeasurementSeq(String measurementSeq) {
		this.measurementSeq = measurementSeq;
	}

	/**
	 * Get value of materialUid
	 *
	 * @return materialUid
	 */
	public String getMaterialUid() {
		return materialUid;
	}

	/**
	 * Set value of materialUid
	 *
	 * @param materialUid
	 */
	public void setMaterialUid(String materialUid) {
		this.materialUid = materialUid;
	}

	/**
	 * Get value of checkPic
	 *
	 * @return checkPic
	 */
	public String getCheckPic() {
		return checkPic;
	}

	/**
	 * Set value of checkPic
	 *
	 * @param newCheckPic
	 */
	public void setCheckPic(String newCheckPic) {
		this.checkPic = newCheckPic;
	}

	/**
	 * Get value of checkContent
	 *
	 * @return checkContent
	 */
	public String getCheckContent() {
		return checkContent;
	}

	/**
	 * Set value of checkContent
	 *
	 * @param newCheckContent
	 */
	public void setCheckContent(String newCheckContent) {
		this.checkContent = newCheckContent;
	}

	/**
	 * Get value of isNeedCollect
	 *
	 * @return isNeedCollect
	 */
	public Boolean getIsNeedCollect() {
		return isNeedCollect;
	}

	/**
	 * Set value of isNeedCollect
	 *
	 * @param newIsNeedCollect
	 */
	public void setIsNeedCollect(Boolean newIsNeedCollect) {
		this.isNeedCollect = newIsNeedCollect;
	}

	/**
	 * Get value of isSubmitCheck
	 *
	 * @return isSubmitCheck
	 */
	public Boolean getIsSubmitCheck() {
		return isSubmitCheck;
	}

	/**
	 * Set value of isSubmitCheck
	 *
	 * @param newIsSubmitCheck
	 */
	public void setIsSubmitCheck(Boolean newIsSubmitCheck) {
		this.isSubmitCheck = newIsSubmitCheck;
	}

	/**
	 * Get value of uom
	 *
	 * @return uom
	 */
	public String getUom() {
		return uom;
	}

	/**
	 * Set value of uom
	 *
	 * @param newUom
	 */
	public void setUom(String newUom) {
		this.uom = newUom;
	}

	/**
	 * Get value of operationUid
	 *
	 * @return operationUid
	 */
	public String getOperationUid() {
		return operationUid;
	}

	/**
	 * Set value of operationUid
	 *
	 * @param operationUid
	 */
	public void setOperationUid(String operationUid) {
		this.operationUid = operationUid;
	}

	/**
	 * Get value of manufactureOperationUid
	 *
	 * @return manufactureOperationUid
	 */
	public String getManufactureOperationUid() {
		return manufactureOperationUid;
	}

	/**
	 * Set value of manufactureOperationUid
	 *
	 * @param manufactureOperationUid
	 */
	public void setManufactureOperationUid(String manufactureOperationUid) {
		this.manufactureOperationUid = manufactureOperationUid;
	}

	/**
	 * Get value of operationCheckOrder
	 *
	 * @return operationCheckOrder
	 */
	public Integer getOperationCheckOrder() {
		return operationCheckOrder;
	}

	/**
	 * Set value of operationCheckOrder
	 *
	 * @param newOperationCheckOrder
	 */
	public void setOperationCheckOrder(Integer newOperationCheckOrder) {
		this.operationCheckOrder = newOperationCheckOrder;
	}

	/**
	 * Get value of barCode
	 *
	 * @return barCode
	 */
	public String getBarCode() {
		return barCode;
	}

	/**
	 * Set value of barCode
	 *
	 * @param newBarCode
	 */
	public void setBarCode(String newBarCode) {
		this.barCode = newBarCode;
	}

	/**
	 * Get value of deviation
	 *
	 * @return deviation
	 */
	public String getDeviation() {
		return deviation;
	}

	/**
	 * Set value of deviation
	 *
	 * @param newDeviation
	 */
	public void setDeviation(String newDeviation) {
		this.deviation = newDeviation;
	}

	/**
	 * Get value of checkResult
	 *
	 * @return checkResult
	 */
	public String getCheckResult() {
		return checkResult;
	}

	/**
	 * Set value of checkResult
	 *
	 * @param newCheckResult
	 */
	public void setCheckResult(String newCheckResult) {
		this.checkResult = newCheckResult;
	}

	/**
	 * Get value of defectDesc
	 *
	 * @return defectDesc
	 */
	public String getDefectDesc() {
		return defectDesc;
	}

	/**
	 * Set value of defectDesc
	 *
	 * @param newDefectDesc
	 */
	public void setDefectDesc(String newDefectDesc) {
		this.defectDesc = newDefectDesc;
	}

	/**
	 * Get value of checker1
	 *
	 * @return checker1
	 */
	public String getChecker1() {
		return checker1;
	}

	/**
	 * Set value of checker1
	 *
	 * @param newChecker1
	 */
	public void setChecker1(String newChecker1) {
		this.checker1 = newChecker1;
	}

	/**
	 * Get value of checker2
	 *
	 * @return checker2
	 */
	public String getChecker2() {
		return checker2;
	}

	/**
	 * Set value of checker2
	 *
	 * @param newChecker2
	 */
	public void setChecker2(String newChecker2) {
		this.checker2 = newChecker2;
	}

	/**
	 * Get value of checkTime1
	 *
	 * @return checkTime1
	 */
	public java.util.Date getCheckTime1() {
		return checkTime1;
	}

	/**
	 * Set value of checkTime1
	 *
	 * @param newCheckTime1
	 */
	public void setCheckTime1(java.util.Date newCheckTime1) {
		this.checkTime1 = newCheckTime1;
	}

	/**
	 * Get value of checkTime2
	 *
	 * @return checkTime2
	 */
	public java.util.Date getCheckTime2() {
		return checkTime2;
	}

	/**
	 * Set value of checkTime2
	 *
	 * @param newCheckTime2
	 */
	public void setCheckTime2(java.util.Date newCheckTime2) {
		this.checkTime2 = newCheckTime2;
	}

	/**
	 * Get value of actualSize1
	 *
	 * @return actualSize1
	 */
	public String getActualSize1() {
		return actualSize1;
	}

	/**
	 * Set value of actualSize1
	 *
	 * @param newActualSize1
	 */
	public void setActualSize1(String newActualSize1) {
		this.actualSize1 = newActualSize1;
	}

	/**
	 * Get value of actualSize2
	 *
	 * @return actualSize2
	 */
	public String getActualSize2() {
		return actualSize2;
	}

	/**
	 * Set value of actualSize2
	 *
	 * @param newActualSize2
	 */
	public void setActualSize2(String newActualSize2) {
		this.actualSize2 = newActualSize2;
	}

	/**
	 * Get value of toolUid1
	 *
	 * @return toolUid1
	 */
	public String getToolUid1() {
		return toolUid1;
	}

	/**
	 * Set value of toolUid1
	 *
	 * @param newToolUid1
	 */
	public void setToolUid1(String newToolUid1) {
		this.toolUid1 = newToolUid1;
	}

	/**
	 * Get value of toolUid2
	 *
	 * @return toolUid2
	 */
	public String getToolUid2() {
		return toolUid2;
	}

	/**
	 * Set value of toolUid2
	 *
	 * @param newToolUid2
	 */
	public void setToolUid2(String newToolUid2) {
		this.toolUid2 = newToolUid2;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see Object#equals(Object)
	 */
	public boolean equals(Object other) {

		if (other == null)
			return false;

		if (other == this)
			return true;

		if (!(other instanceof CheckBillDetail))
			return false;

		CheckBillDetail cast = (CheckBillDetail) other;

		if (this.uniqueId == null ? cast.getUniqueId() != this.uniqueId : !this.uniqueId.equals(cast.getUniqueId()))
			return false;

		return true;
	}

	public String getXAxis() {
		return xAxis;
	}

	public void setXAxis(String xAxis) {
		this.xAxis = xAxis;
	}

	public String getYAxis() {
		return yAxis;
	}

	public void setYAxis(String yAxis) {
		this.yAxis = yAxis;
	}

	public Float getUpperLimitPercent() {
		return upperLimitPercent;
	}

	public void setUpperLimitPercent(Float upperLimitPercent) {
		this.upperLimitPercent = upperLimitPercent;
	}

	public Float getLowerLimitPercent() {
		return lowerLimitPercent;
	}

	public void setLowerLimitPercent(Float lowerLimitPercent) {
		this.lowerLimitPercent = lowerLimitPercent;
	}

	public Employee getChecker() {
		return checker;
	}

	public void setChecker(Employee checker) {
		this.checker = checker;
	}

	public Material getMaterial() {
		return material;
	}

	public void setMaterial(Material material) {
		this.material = material;
	}

	public Boolean getIsKeyMeasurement() {
		return isKeyMeasurement;
	}

	public void setIsKeyMeasurement(Boolean isKeyMeasurement) {
		this.isKeyMeasurement = isKeyMeasurement;
	}

	public Boolean getIsNeedStatistic() {
		return isNeedStatistic;
	}

	public void setIsNeedStatistic(Boolean isNeedStatistic) {
		this.isNeedStatistic = isNeedStatistic;
	}

	public Employee getWorker() {
		return worker;
	}

	public void setWorker(Employee worker) {
		this.worker = worker;
	}

}